package utils;

import java.util.LinkedList;
import java.util.List;

public class InfoProc extends Info {

	private List<ParametroFormal> params;

	public InfoProc(String t) {
		super(t);
		params = new LinkedList<ParametroFormal>();
	}

	public InfoProc(String t, List<ParametroFormal> params) {
		super(t);
		this.params = params;
	}

	public Integer getNParams() {
		return params.size();
	}
	
	public List<ParametroFormal> getParams() {
		return params;
	}

	public void setParams(List<ParametroFormal> params) {
		this.params = params;
	}
	
	public ParametroFormal getParam(int index) {
		return params.get(index);
	}
	
	public Info getTipo(int index) {
		return getParam(index).getTipo();
	}

	public boolean equals(Object o) {
		if (o == null)
			return false;
		
		if (!(o instanceof InfoProc))
			return false;

		InfoProc e = (InfoProc) o;
		return t.equals(e.getT()) && tam.equals(e.getTam())
				&& params.equals(e.getParams());
	}
	
	public String toString() {
		return "<t: proc, params: " + params + ">";
	}
}
